#!/bin/bash
# 获取Go版本  
go_version=$(go version | awk '{print $3}')  
  
minor_version=$(echo "$go_version" | awk -F . '{print $2}')  
  
if (( minor_version > 15 )); then  
    go version
    echo "Go版本大于1.15"  
else  
    echo "请安装 Go 1.15 以上版本"  
    exit 1
fi

tar xvf x264.tar.gz
pushd x264
./configure --enable-static  
make  
sudo make install
popd
rm -rf x264

tar xvf ffmpeg-5.1.4.tar.xz
cp -f ./ffmpeg_rtmp_h265/* ./ffmpeg-5.1.4/libavformat/
pushd ffmpeg-5.1.4
./configure --prefix=../bin --enable-libx264 --enable-static --disable-shared --enable-gpl
make -j8
sudo make install
popd
rm -rf ffmpeg-5.1.4
go build
